﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Linq;

using Marking.Dashboard.ViewModels.Stock;

namespace Marking.Dashboard.Services.Locals
{
    public class LocalStockService : IStockService
    {
        private static List<string> _mockWarehouses = new List<string>
        {
            "东莞",
            "广州",
            "佛山",
            "清远",
            "中山",
            "韶关",
            "福州",
            "惠州"
        };

        public void LoadColouredClothStockInfos(Action<IEnumerable<StockInfo>> action)
        {
            this.MockResult(action);
        }

        public void LoadClothStockInfos(Action<IEnumerable<StockInfo>> action)
        {
            this.MockResult(action);
        }

        public void LoadSalesClothStockInfos(Action<IEnumerable<StockInfo>> action)
        {
            this.MockResult(action);
        }

        private void MockResult(Action<IEnumerable<StockInfo>> action)
        {
            action(_mockWarehouses.Select(x =>
            {
                return new StockInfo
                {
                    Warehouse = x,
                    Quantity = new Random(Guid.NewGuid().GetHashCode()).Next(100, 500)
                };
            }));
        }
    }
}
